package com.novoda.runbuddy.activity;

import android.database.sqlite.SQLiteDatabase;
import android.test.ActivityInstrumentationTestCase;

import com.novoda.runbuddy.R;
import com.novoda.runbuddy.util.DBUtil;

public class RouteRunnerTest extends ActivityInstrumentationTestCase<RouteRunner> {
	private static final String	RUN_BUDDY_DB	= "runBuddyDB1.db";
	private SQLiteDatabase		mdb;
	private DBUtil				dbUtil			= null;

	public RouteRunnerTest() {
		super("com.novoda.runbuddy", RouteRunner.class);
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		//this.getInstrumentation().startActivitySync(new Intent(getActivity().getContext(), Home.class));
		
		final RouteRunner a = getActivity();

		if (dbUtil == null) {
			dbUtil = new DBUtil(a.getContext(), RUN_BUDDY_DB);
		}
		dbUtil.executeDB(R.raw.db_drop);
		dbUtil.createDB();
		dbUtil.insertValuesIntoDB();
		mdb = dbUtil.getDatabase();
		if (mdb == null)
			mdb = a.getContext().openOrCreateDatabase(RUN_BUDDY_DB, SQLiteDatabase.OPEN_READWRITE, null);
	}

	public void testTrue() throws Exception {
        getInstrumentation().waitForIdleSync();
		assertTrue(true);
	}

}
